<?php

namespace App\Http\Controllers\Backend\Api\V1;

use App\Http\Requests\Backend\SpaceSchemeRequest;
use App\Services\Gallery\Interfaces\SpaceSchemeServiceInterface;
use App\Services\Gallery\Services\SpaceSchemeService;
use Illuminate\Http\Request;

class SpaceSchemeController extends BaseController
{
    /**
     * @var SpaceSchemeService
     */
    protected $SpaceSchemeService;


    public function __construct(SpaceSchemeServiceInterface $SpaceSchemeService)
    {
        $this->SpaceSchemeService = $SpaceSchemeService;
    }

    public function index(Request $request)
    {
        $space_scheme_series = $this->SpaceSchemeService->index($request->all());
        return $this->successData($space_scheme_series);
    }

    public function create()
    {
        return $this->successData();
    }

    public function store(SpaceSchemeRequest $request)
    {
        $this->SpaceSchemeService->set($request->filldata());
        return $this->success();
    }

    public function edit($id)
    {
        $space_scheme = $this->SpaceSchemeService->get($id);
        return $this->successData(compact('space_scheme'));
    }

    public function update(SpaceSchemeRequest $request, $id)
    {
        $this->SpaceSchemeService->set($request->filldata(), $id);
        return $this->success();
    }

    public function destroy($id)
    {
        $this->SpaceSchemeService->destroy($id);
        return $this->success();
    }
}
